home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
thesource-7.lha
/
Source
/
DefFunc.lha
/
DefFunc
/
dfctree.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-14
|
2KB
|
89 lines
/*********************************************************
*
* Copyright (c) 1993 Ke Jin
*
* Permission to use, copy, modify, and distribute
* this software and its documentation without fee
* is granted, provided that the author's name and
* this copyright notice are retained.
*
* -----------------------------------------------------
*
* dfctree.h -- interface of defunc low level module
*
* struct definition : Node
*
* external function : exparse();
* evaluate();
* getparsetree();
* reduce();
*
*********************************************************/
#ifndef _DFCTREE_H
#define _DFCTREE_H
#ifndef NeedFunctionPrototypes
#if defined(__STDC__)||defined(__cplusplus)
#define NeedFunctionPrototypes 1
#else
#define NeedFunctionPrototypes 0
#endif /* __STDC__ */
#endif /* NeedFunctionPrototypes */
#ifdef __cplusplus
extern "C" { /* for c++ */
#endif
typedef enum {
const_node,
arg_node,
unary_op_node,
binary_op_node,
simplex_fnct_node,
duplex_fnct_node,
triplex_fnct_node, /* not used in current version */
arg_fnct_node /* not used in current version */
} Node_type;
typedef enum {
op_sum,
op_sub,
op_mul,
op_div,
op_neg
} op_idx;
typedef struct {
Node_type type;
union {
int argidx;
op_idx op;
double value;
double (*fnctptr)();
} content;
int left;
int right;
} Node;
#if NeedFunctionPrototypes /* ANSI */
extern int exparse(char* expression);
extern double evaluate(Node* tree, int i, double x, double y);
extern int getparsetree(Node* buff);
extern Node* reduce(Node* tree, int i);
#else /* K&R */
extern int exparse();
extern double evaluate();
extern int getparsetree();
extern Node* reduce();
#endif /* NeedFunctionPrototype */
#ifdef __cplusplus
} /* end for c++ */
#endif
#endif /* _DFCTREE_H */